using System;

namespace Microsoft.WowAddonStudio.Lua.RuntimeService.WowBench
{
	/// <summary>
	/// 
	/// </summary>
	public sealed partial class RichTextOutputControl
	{

		#region ISynchronizeInvoke Members

		///<summary>
		///Executes the delegate on the main thread that this object executes on.
		///</summary>
		///<returns>
		///An <see cref="T:System.IAsyncResult"></see> interface that represents the asynchronous operation started by calling this method.
		///</returns>
		///<param name="args">An array of type <see cref="T:System.Object"></see> to pass as arguments to the given method. This can be null if no arguments are needed. </param>
		///<param name="method">A <see cref="T:System.Delegate"></see> to a method that takes parameters of the same number and type that are contained in args. </param>
		public IAsyncResult BeginInvoke(Delegate method, object[] args)
		{
			return textBox.BeginInvoke(method, args);
		}

		///<summary>
		///Waits until the process started by calling <see cref="M:System.ComponentModel.ISynchronizeInvoke.BeginInvoke(System.Delegate,System.Object[])"></see> completes, and then returns the value generated by the process.
		///</summary>
		///<returns>
		///An <see cref="T:System.Object"></see> that represents the return value generated by the asynchronous operation.
		///</returns>
		///<param name="result">An <see cref="T:System.IAsyncResult"></see> interface that represents the asynchronous operation started by calling <see cref="M:System.ComponentModel.ISynchronizeInvoke.BeginInvoke(System.Delegate,System.Object[])"></see>. </param>
		public object EndInvoke(IAsyncResult result)
		{
			return textBox.EndInvoke(result);
		}

		///<summary>
		///Executes the delegate on the main thread that this object executes on.
		///</summary>
		///<returns>
		///An <see cref="T:System.IAsyncResult"></see> interface that represents the asynchronous operation started by calling this method.
		///</returns>
		///<param name="method">A <see cref="T:System.Delegate"></see> to a method that takes parameters of the same number and type that are contained in args. </param>
		public object BeginInvoke(Delegate method)
		{
			return textBox.BeginInvoke(method);
		}

		///<summary>
		///Executes the delegate on the main thread that this object executes on.
		///</summary>
		///<returns>
		///An <see cref="T:System.Object"></see> that represents the return value from the delegate being invoked, or null if the delegate has no return value.
		///</returns>
		///<param name="method">A <see cref="T:System.Delegate"></see> that contains a method to call, in the context of the thread for the control. </param>
		public object Invoke(Delegate method)
		{
			return textBox.Invoke(method);
		}

		///<summary>
		///Executes the delegate on the main thread that this object executes on.
		///</summary>
		///<returns>
		///An <see cref="T:System.Object"></see> that represents the return value from the delegate being invoked, or null if the delegate has no return value.
		///</returns>
		///<param name="args">An array of type <see cref="T:System.Object"></see> that represents the arguments to pass to the given method. This can be null if no arguments are needed. </param>
		///<param name="method">A <see cref="T:System.Delegate"></see> that contains a method to call, in the context of the thread for the control. </param>
		public object Invoke(Delegate method, object[] args)
		{
			return textBox.Invoke(method, args);
		}

		///<summary>
		///Gets a value indicating whether the caller must call <see cref="M:System.ComponentModel.ISynchronizeInvoke.Invoke(System.Delegate,System.Object[])"></see> when calling an object that implements this interface.
		///</summary>
		///<returns>
		///true if the caller must call <see cref="M:System.ComponentModel.ISynchronizeInvoke.Invoke(System.Delegate,System.Object[])"></see>; otherwise, false.
		///</returns>
		public bool InvokeRequired
		{
			get { return textBox.InvokeRequired; }
		}

		#endregion

	}
}